#include <iostream>
#include <ctime>
#include "ThreadPool.hpp"
using namespace std;
string opers = "+-*/%";
int main()
{
    srand(time(nullptr));
    ThreadPool<Task>* tp = ThreadPool<Task>::GetThreadPool();
    tp->Run();
    
    //主线程推送任务
    while(true)
    {
        sleep(1);
        int len = opers.size();
        int x = rand() % 10;
        int y = rand() % 5;
        char op = opers[rand() % len];
        Task t(x, y, op);
        tp->Push(t);
        cout << "main thread make task: " << t.put_task() << endl;
    }
    ThreadPool<Task>::DelThreadPool();
    //delete tp;
    return 0;
}